package com.example.dc.mapper;


import com.example.dc.domain.PersonalQuestion;
import com.example.dc.domain.Question;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PersonalMapper {

    @Select("select * from d_question where grade=4")
    public List<PersonalQuestion> setFourStanderQuestion();

    //更新抽到问题的id
    @Update("update d_personality_questions set recent_call=NOW() where question_id=#{questionId} and user_id=#{userId}")
    public void updateQuestionTime(@Param("questionId") Integer questionId,@Param("userId") Integer userId);

    @Insert("insert into d_personality_questions(question_id, user_id, mutiple,second_stander) VALUES (#{questionId},#{userId},#{multiple},#{secondStander})")
    public void insertQuestion(@Param("questionId") Integer questionId,@Param("userId") Integer userId,@Param("multiple") Double multiple,@Param("secondStander") Integer secondStander);

    @Select("select mutiple from d_personality_questions where question_id=#{questionId} and user_id=#{userId}")
    public Double getMutiple(@Param("questionId") Integer questionId,@Param("userId") Integer userId);

    @Select("select count(id) from d_personality_questions where user_id=#{userId}")
    public Integer healthIsOpen(@Param("userId") Integer userId);
}
